/*
 * =====================================================================================
 *
 *       Filename:  modbus.h
 *
 *    Description:  
 *
 *        Version:  1.0
 *        Created:  2020年03月05日 14时55分24秒
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  YOUR NAME (), 
 *   Organization:  
 *
 * =====================================================================================
 */
#ifndef _MODBUS_TCP_H_
#define _MODBUS_TCP_H_
#include <stdint.h>

#define ALIGN_CANCEL __attribute__((packed))

typedef struct {

    uint8_t trans[2];
    uint16_t proto;
    uint16_t length;
    uint8_t  unit;
}ALIGN_CANCEL MBAP;

typedef struct{
    uint8_t opcode;
    uint16_t address;
    uint16_t count;
}ALIGN_CANCEL REQ_PDU_0x01;


typedef struct {
    uint8_t opcode;
    uint8_t bytes;
}ALIGN_CANCEL RSP_PDU_0x01;

typedef struct {
    uint8_t opcode;
    uint8_t errcode; 
}ALIGN_CANCEL RSP_PDU_0x01_err;

#endif
